<style scoped src="./index.scss" lang="scss" rel="stylesheet/scss"></style>
<template src="./index.html"></template>
<script>


export default {
    mixins: [Vue.prototype.$vFN.Mixins.Base,Vue.prototype.$vFN.Mixins.Page],
    components: {},
    data() {
        return {
            appWindow: window,
            form: {
                name: "",
                roleMenuRelationLst: [],
                authMenuIdLst: [],
            },
            

            // 页面接口地址
            apiUrl: {
                list: "mall-site-portal/ums-role/list",
                create: "mall-site-portal/ums-role/create",
                update: "mall-site-portal/ums-role/update",
                delete: "mall-site-portal/ums-role/delete",
                detail: "mall-site-portal/ums-role/getItem"
            },
            // 表格查询数据
            mixinTable_tableSearchData: {
                name: "",
            },
            // 表格数据
            tableData: [],
            // 表格数据删除展示结构
            tableDeleteConfig: {
                columns: [{label: "角色名称", prop: "name"}],
            },

            listCanAuthMenu: [],
        };
    },
    methods: {
        async getAuthMenu() {
            // 获取用户信息
            let _data = await this.$vFN.Http.post({
                url: "mall-site-portal/ums-role/listCanAuthMenu",
            },window);
            if (_data._ok) {
                this.listCanAuthMenu = _data.data;
            }
        },

        // 编辑修改的参数扩展方法
        mixinEdit_editDataExtend(data_) {
            return data_;
        },
        // form 提交添加/修改 的参数扩展方法
        mixinEdit_editFormSubmitExtend(data_) {
            let _arr = this.$refs.roleTree.getCheckedKeys();
            _arr.map((item) => {
                data_.roleMenuRelationLst.push({
                    menuId: item
                })
            })
            return data_;
        },
        // 清空扩展
        mixinEdit_resetFormExtend(name_){
            this.$refs.roleTree.setCheckedKeys([]);
        },
        // 初始化
        async init() {
            // 获取表格数据
            this.mixinTable_getTable("tableData", 1);
            this.getAuthMenu();
        },
    },
    mounted() {
        this.init();
    },
    activated() {
    },
};
</script>



